package demo6;

import static sun.awt.image.PixelConverter.UshortGray.instance;

public class Singleton {
    //3定义私有静态当前类的属性并初始化
    private static Singleton instance = new Singleton();

    //1构造器私有化
    private Singleton(){}

    //2提供公开静态能获取当前实例的方法
    public static Singleton getInstance(){
        //4始终返回同一个对象属性
        return instance;
    }
}
